package com.power.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.power.model.jdao.xjrwDao;
import com.power.model.mdao.XjrwMapper;
import com.power.model.pojo.Xjrw;

@Service
public class XjrwService {
	@Autowired
	XjrwMapper pm;
	@Autowired 
	xjrwDao xdao;
	public List<Xjrw> findall(Integer pageNum, Integer pageSize){
		PageHelper.startPage(pageNum, pageSize);
		List<Xjrw> list=pm.xunjianfindall();
		return list;
	}
	
	public void addxujian(String rwname,String xunjianuser,String xunjianxl,String beizhu
			,String rwzhixingqk, String xiauser) {
		Xjrw xjw=new Xjrw(beizhu, rwname, rwzhixingqk, new Date(), xiauser, xunjianuser, xunjianxl);
		xjw.setSfqx(0);
		xdao.save(xjw);
		
	}
	public void updatexunjian(String rwname,String xunjianuser,String xunjianxl,String beizhu
			,String rwzhixingqk, String xiauser,Integer sfqx,Date xiadate,String rwtype,Integer rwid) {
		
		Xjrw xjw=new Xjrw(beizhu, rwname, rwtype, rwzhixingqk, sfqx, xiadate, xiauser, xunjianuser, xunjianxl);
		xjw.setRwid(rwid);
		xdao.save(xjw);
	}
	
	public List<Xjrw> xunjianselect(String xunjianxl,String rwname,String rwtype,String xiauser){
		System.err.println(xunjianxl+"---"+rwname+"----"+rwtype+"--"+xiauser);

		List<Xjrw> list=pm.xunjianselect(xunjianxl, rwname, rwtype, xiauser);
		System.err.println("查询结果:"+list.size());
		System.err.println("查询信息"+list.toString());
		return list;
	}
}
